import openpyexcel
wb=openpyexcel.load_workbook('人员档案.xlsx')
sheet1=wb["Sheet1"]
sheet2=wb["Sheet2"]
old=sheet1['A']
new1=sheet1['B']
names1=sheet1['C']
new2=sheet2['A']
cap2=sheet2['B']
oder=0
i=2
while i <= 7:
    j = 2
    k = 2
    while k <= 5:
        while sheet1.cell(i,1).value==sheet2.cell(k,1).value:
            while j <= 5:
                if sheet1.cell(i, 2).value == sheet2.cell(j, 1).value:
                    if sheet2.cell(j, 2).value < 2:
                        print(names1[i].value, end="")
                        print("从", end="")
                        print(old[i].value, end="")
                        print("移到", end="")
                        print(new1[i].value)
                        sheet2.cell(j, 2).value += 1
                        sheet2.cell(k, 2).value -= 1
                        oder += 1
                        sheet1.cell(i, 4).value = oder
                j += 1
        k += 1
    i += 1